package com.lry.jvm.example.exp1;

import com.lry.jvm.example.Anno;
import com.lry.jvm.example.exp1.service.UserService;
import com.lry.jvm.example.exp1.service.impl.UserServiceImpl;
import com.lry.jvm.example.exp2.service.impl.OrderServiceImpl;

@Anno(value = "哈哈啊哈哈 value")
public class Exp1 {

    public int field = 1;

    public int t(){
        System.out.println(1);
        return 1;
    }
    public static void main(String[] args) {
//        int sum = 0;
//        for(int i=0;i<=100;i++){
//            sum+=i;
//        }
        //invokevirtual
        Exp1 exp1 = new Exp1();
        int t = exp1.t();
        System.out.println(t);

//        exp1.field = sum;
//        System.out.println(sum);
//        System.out.println(exp1.field);

        //invokeinterface
        UserService userService = new UserServiceImpl();
        int age = userService.queryAgeById(1);
        System.out.println(age);

        //invokestatic
        System.out.println(UserServiceImpl.testStatic(25));

        System.out.println(OrderServiceImpl.testStatic(25000));
        System.out.println(OrderServiceImpl.testStatic(-60));
        System.out.println(OrderServiceImpl.testStatic(-25000));
        System.out.println(OrderServiceImpl.testStatic(60));

        int [] intArr = new int[2];
        intArr[0] = 1;
        intArr[1] = 2;
        System.out.println(intArr[0]);
        System.out.println(intArr[1]);
        System.out.println("Hello World!");

//        System.out.println(void.class.getName());
    }
}

//Boolean(Z),byte(B),short(S),char(C),int(I),float(F),double(D),long(J)

//GETSTATIC:178 ,0xb2
//INVOKEVIRTUAL:182,0xb6

//         mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
//         mv.visitVarInsn(ICONST_1,1);
//         mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(I)V", false);


//         mv3.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
//         mv3.visitLdcInsn("value is false");
//         mv3.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false);